﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefProcessRouteItem" :model="stateProcessRouteItem.vmModel" label-width="100px">
    <div style="margin-bottom:10px;">{{$t('message.autotrans.SysBatchEditConfirm')}}</div>
    <el-row>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_RoutieId_FormItem" prop="LinkedVM.RoutieId" :label="$t('message.autotrans._Model_ProcessRouteItem_Routie')">
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.RoutieId" clearable>
             <el-option v-for="item in stateProcessRouteItem.AllRouties" :key="item.Value" :value="item.Value" :label="item.Text"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_GroupCode_FormItem" prop="LinkedVM.GroupCode" :label="$t('message.autotrans._Model_ProcessRouteItem_GroupCode')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.GroupCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OpCode_FormItem" prop="LinkedVM.OpCode" :label="$t('message.autotrans._Model_ProcessRouteItem_OpCode')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpCode')}), trigger: 'blur' }]" >
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.OpCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OpName_FormItem" prop="LinkedVM.OpName" :label="$t('message.autotrans._Model_ProcessRouteItem_OpName')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpName')}), trigger: 'blur' }]" >
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.OpName" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_OpType_FormItem" prop="LinkedVM.OpType" :label="$t('message.autotrans._Model_ProcessRouteItem_OpType')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpType')}), trigger: 'blur' }]" >
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.OpType" clearable>
             <el-option key="Assembling" value="Assembling" :label="$t('message.autotrans._Enum_OpTypeEnum_Assembling')"></el-option>
             <el-option key="Detection" value="Detection" :label="$t('message.autotrans._Enum_OpTypeEnum_Detection')"></el-option>
             <el-option key="Rework" value="Rework" :label="$t('message.autotrans._Enum_OpTypeEnum_Rework')"></el-option>
             <el-option key="TakePartInOrOut" value="TakePartInOrOut" :label="$t('message.autotrans._Enum_OpTypeEnum_TakePartInOrOut')"></el-option>
             <el-option key="Weild" value="Weild" :label="$t('message.autotrans._Enum_OpTypeEnum_Weild')"></el-option>
             <el-option key="PrintMark" value="PrintMark" :label="$t('message.autotrans._Enum_OpTypeEnum_PrintMark')"></el-option>
             <el-option key="Fds" value="Fds" :label="$t('message.autotrans._Enum_OpTypeEnum_Fds')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_ErpOpCode_FormItem" prop="LinkedVM.ErpOpCode" :label="$t('message.autotrans._Model_ProcessRouteItem_ErpOpCode')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.ErpOpCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_StdOpDuration_FormItem" prop="LinkedVM.StdOpDuration" :label="$t('message.autotrans._Model_ProcessRouteItem_StdOpDuration')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_StdOpDuration')}), trigger: 'blur' }]" >
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.StdOpDuration" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_StdPrepDuration_FormItem" prop="LinkedVM.StdPrepDuration" :label="$t('message.autotrans._Model_ProcessRouteItem_StdPrepDuration')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.StdPrepDuration" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PolicyCheckPrevProc_FormItem" prop="LinkedVM.PolicyCheckPrevProc" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckPrevProc')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckPrevProc')}), trigger: 'blur' }]" >
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.PolicyCheckPrevProc" clearable>
             <el-option key="None" value="None" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_None')"></el-option>
             <el-option key="Worked" value="Worked" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_Worked')"></el-option>
             <el-option key="WorkedAndOK" value="WorkedAndOK" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_WorkedAndOK')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PolicyCheckProcBom_FormItem" prop="LinkedVM.PolicyCheckProcBom" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcBom')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcBom')}), trigger: 'blur' }]" >
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.PolicyCheckProcBom" clearable>
             <el-option key="None" value="None" :label="$t('message.autotrans._Enum_PolicyCheckProcBomEnum_None')"></el-option>
             <el-option key="Over" value="Over" :label="$t('message.autotrans._Enum_PolicyCheckProcBomEnum_Over')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_PolicyCheckProcess_FormItem" prop="LinkedVM.PolicyCheckProcess" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcess')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcess')}), trigger: 'blur' }]" >
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.PolicyCheckProcess" clearable>
             <el-option key="AllowedEntryRepeat" value="AllowedEntryRepeat" :label="$t('message.autotrans._Enum_PolicyCheckProcessEnum_AllowedEntryRepeat')"></el-option>
             <el-option key="CheckBOMSource" value="CheckBOMSource" :label="$t('message.autotrans._Enum_PolicyCheckProcessEnum_CheckBOMSource')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_CtlAttr_FormItem" prop="LinkedVM.CtlAttr" :label="$t('message.autotrans._Model_ProcessRouteItem_CtlAttr')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_CtlAttr')}), trigger: 'blur' }]" >
          <el-select v-model="stateProcessRouteItem.vmModel.LinkedVM.CtlAttr" clearable>
             <el-option key="Must" value="Must" :label="$t('message.autotrans._Enum_ProcCtlAttrEnum_Must')"></el-option>
             <el-option key="Optional" value="Optional" :label="$t('message.autotrans._Enum_ProcCtlAttrEnum_Optional')"></el-option>
          </el-select>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Pos_FormItem" prop="LinkedVM.Pos" :label="$t('message.autotrans._Model_ProcessRouteItem_Pos')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_Pos')}), trigger: 'blur' }]" >
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.Pos" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Etag_FormItem" prop="LinkedVM.Etag" :label="$t('message.autotrans._Model_ProcessRouteItem_Etag')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.Etag" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Active_FormItem" prop="LinkedVM.Active" :label="$t('message.autotrans._Model_ProcessRouteItem_Active')"          :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_Active')}), trigger: 'blur' }]" >
          <el-switch v-model="stateProcessRouteItem.vmModel.LinkedVM.Active" clearable></el-switch>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_EquipmentId_FormItem" prop="LinkedVM.EquipmentId" :label="$t('message.autotrans._Model_ProcessRouteItem_EquipmentId')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.EquipmentId" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_EquipmentCode_FormItem" prop="LinkedVM.EquipmentCode" :label="$t('message.autotrans._Model_ProcessRouteItem_EquipmentCode')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.EquipmentCode" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Aux_1_FormItem" prop="LinkedVM.Aux_1" :label="$t('message.autotrans._Model_ProcessRouteItem_Aux_1')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.Aux_1" clearable></el-input>
      </el-form-item>

      </el-col>
      <el-col :xs="24" :lg="12" class="mb20">
      <el-form-item ref="LinkedVM_Aux_2_FormItem" prop="LinkedVM.Aux_2" :label="$t('message.autotrans._Model_ProcessRouteItem_Aux_2')">
          <el-input v-model="stateProcessRouteItem.vmModel.LinkedVM.Aux_2" clearable></el-input>
      </el-form-item>

      </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitProcessRouteItem"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

      <WtmButton @click="onCloseProcessRouteItem"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

    </div>

  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageProcessManagementProcessRouteItemBatchEdit;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { processrouteitemApi } from '/@/api/processmanagement/processrouteitem';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefProcessRouteItem = ref();
const stateProcessRouteItem = reactive({
    vmModel: {
	  LinkedVM:{
        RoutieId: null,
        GroupCode: '',
        OpCode: '',
        OpName: '',
        OpType: undefined,
        ErpOpCode: '',
        StdOpDuration:null,
        Pos:null,
        StdPrepDuration:null,
        EquipmentId:null,
        PolicyCheckPrevProc: undefined,
        PolicyCheckProcBom: undefined,
        PolicyCheckProcess: undefined,
        CtlAttr: undefined,
        Etag: '',
        Active: undefined,
        EquipmentCode: '',
        Aux_1: '',
        Aux_2: '',
      },
      Ids:[],
      
	},
    
    AllRouties: [] as any[],
});

// 取消
const onCloseProcessRouteItem = () => {
    closeDialog();
};

// 提交
const onSubmitProcessRouteItem = () => {
	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});

    formRefProcessRouteItem.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            processrouteitemApi().batchedit(stateProcessRouteItem.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error:any) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};


// 页面加载时
onMounted(() => {
    
    other.getSelectList('/api/ProcessManagement/ProcessRouteItem/GetProcessRoutes',[],false).then(x=>{stateProcessRouteItem.AllRouties = x});
    if (ci.attrs["wtmdata"]) {
		stateProcessRouteItem.vmModel.Ids = ci.attrs["wtmdata"];
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateProcessRouteItem.vmModel.Ids = useRouter().currentRoute.value.query.id as any;
	}

});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

